#登录页
from selenium.webdriver.common.by import By

from utils.page_base import PageBase #页面基类

#首页ui
class PageUI2(PageBase):
    pathUrl="/simple/login"
    loc_zanhao=By.NAME,"login_info"
    loc_pwd=By.NAME,"password"
    loc_login=By.CSS_SELECTOR,"input.input_submit[type='submit'][value='登录']"
    loc_ErrorTips=By.CSS_SELECTOR,"div.prompt"


    def __init__(self,driver,base_url):
        PageBase.__init__(self,driver,base_url)

    #打开当前url
    def openUrl(self):
        self.open(PageUI2.pathUrl)

    #输入某账号
    def input_zanhao(self,zanhao):
        self.input(PageUI2.loc_zanhao,zanhao)


    #输入某密码
    def input_pwd(self,pwd):
        self.input(PageUI2.loc_pwd,pwd)


    #点击“登录”按钮
    def click_login(self):
        self.click(PageUI2.loc_login)


    #获取错误提示div标签的文本内容
    def getErrorTipText(self):
        return self.getEleText(PageUI2.loc_ErrorTips)


    #获取密码框的class属性的值："input_text       invalid-text"
    def getPwdClass(self):
        return self.getEleAttr(PageUI2.loc_pwd,"class")


    # 获取账号框的class属性的值："input_text       invalid-text"
    def getZanhaoClass(self):
        return self.getEleAttr(PageUI2.loc_zanhao,"class")
